# 导包
from selenium import webdriver
import time
from selenium.webdriver.common.by import By

# 创建浏览器驱动对象
driver = webdriver.Edge(r"C:\ProgramData\Anaconda3\msedgedriver.exe")
driver.maximize_window()

# 打开页面
driver.get(r"file:///D:\Downloads\ALiYunDrive\学习\计算机大三下\软件测试\实验8 Selenium API示例代码实验（一）\Selenium API示例代码\html\注册A.html")

# 在用户名输入框中输入admin
# 查看源代码的快捷键：按住Ctrl 移动光标，再点击
driver.find_element_by_id("userA").send_keys("admin")

# 导包的快捷键：Alt + 回车，再选择对应的选项
driver.find_element(By.ID, "passwordA").send_keys("123456")
driver.find_element_by_id("telA").send_keys("13800000001")
driver.find_element_by_name("emailA").send_keys("abc@gmail.com")
driver.find_element_by_id("pga").click()
driver.find_element_by_name("hobby").click()
# 暂停3秒
time.sleep(3)

# 关闭驱动
driver.quit()
